.TH "IRC commands: other stuff." 3 "3 Jan 2009" "Version 1.3" "libircclient" \" -*- nroff -*-
.ad l
.nh
.SH NAME
IRC commands: other stuff. \- 
.SS "Functions"

.in +1c
.ti -1c
.RI "int \fBirc_send_raw\fP (\fBirc_session_t\fP *session, const char *format,...)"
.br
.RI "\fISends raw data to the IRC server. \fP"
.ti -1c
.RI "int \fBirc_cmd_quit\fP (\fBirc_session_t\fP *session, const char *reason)"
.br
.RI "\fISends QUIT command to the IRC server. \fP"
.ti -1c
.RI "int \fBirc_cmd_user_mode\fP (\fBirc_session_t\fP *session, const char *mode)"
.br
.RI "\fIViews or changes your own user mode. \fP"
.ti -1c
.RI "int \fBirc_cmd_nick\fP (\fBirc_session_t\fP *session, const char *newnick)"
.br
.RI "\fIChanges your nick. \fP"
.ti -1c
.RI "int \fBirc_cmd_whois\fP (\fBirc_session_t\fP *session, const char *nick)"
.br
.RI "\fIQueries the information about the nick. \fP"
.in -1c
.SH "Function Documentation"
.PP 
.SS "int irc_cmd_nick (\fBirc_session_t\fP * session, const char * newnick)"
.PP
Changes your nick. 
.PP
\fBParameters:\fP
.RS 4
\fIsession\fP An initiated and connected session. 
.br
\fInewnick\fP A new nick. Must not be NULL.
.RE
.PP
\fBReturns:\fP
.RS 4
Return code 0 means success. Other value means error, the error code may be obtained through \fBirc_errno()\fP. Any error, generated by the IRC server, is available through \fBirc_callbacks_t::event_numeric\fP.
.RE
.PP
This function is used to change your current nick to another nick. Note that such a change is not always possible; for example you cannot change nick to the existing nick, or (on some servers) to the registered nick.
.PP
Possible error responces for this command from the RFC1459:
.IP "\(bu" 2
\fBLIBIRC_RFC_ERR_NONICKNAMEGIVEN\fP
.IP "\(bu" 2
\fBLIBIRC_RFC_ERR_ERRONEUSNICKNAME\fP
.IP "\(bu" 2
\fBLIBIRC_RFC_ERR_NICKNAMEINUSE\fP
.IP "\(bu" 2
\fBLIBIRC_RFC_ERR_NICKCOLLISION\fP 
.PP

.SS "int irc_cmd_quit (\fBirc_session_t\fP * session, const char * reason)"
.PP
Sends QUIT command to the IRC server. 
.PP
\fBParameters:\fP
.RS 4
\fIsession\fP An initiated and connected session. 
.br
\fIreason\fP A reason to quit. May be NULL.
.RE
.PP
\fBReturns:\fP
.RS 4
Return code 0 means success. Other value means error, the error code may be obtained through \fBirc_errno()\fP. Any error, generated by the IRC server, is available through \fBirc_callbacks_t::event_numeric\fP.
.RE
.PP
This function sends the QUIT command to the IRC server. This command forces the IRC server to close the IRC connection, and terminate the session. 
.SS "int irc_cmd_user_mode (\fBirc_session_t\fP * session, const char * mode)"
.PP
Views or changes your own user mode. 
.PP
\fBParameters:\fP
.RS 4
\fIsession\fP An initiated and connected session. 
.br
\fImode\fP A user mode, described below. If NULL, the user mode is not changed, just the old mode is returned.
.RE
.PP
\fBReturns:\fP
.RS 4
Return code 0 means success. Other value means error, the error code may be obtained through \fBirc_errno()\fP. Any error, generated by the IRC server, is available through \fBirc_callbacks_t::event_numeric\fP.
.RE
.PP
The \fBirc_cmd_user_mode()\fP is used to change or view the user modes. Note that, unlike channel modes, not all user modes can be changed. The user mode is returned if the \fImode\fP is NULL. If the \fImode\fP is not NULL, the mode for you will be changed, and new mode will be returned.
.PP
Like channel mode, user mode is also represended by the letters combination. All the user mode letters are boolean (i.e. could only be set or reset), they are set by adding a plus sign before the letter, and reset by adding a minus sign before the letter.
.PP
Here is the list of 'standard' user modes:
.PP
.IP "\(bu" 2
\fIo\fP - represents an IRC operator status. Could not be set directly (but can be reset though), to set it use the IRC \fIOPER\fP command.
.PP
.PP
.IP "\(bu" 2
\fIi\fP - if set, marks a user as 'invisible' - that is, not seen by lookups if the user is not in a channel.
.PP
.PP
.IP "\(bu" 2
\fIw\fP - if set, marks a user as 'receiving wallops' - special messages generated by IRC operators using WALLOPS command.
.PP
.PP
.IP "\(bu" 2
\fIs\fP - if set, marks a user for receipt of server notices.
.PP
.PP
.IP "\(bu" 2
\fIr\fP - NON-STANDARD MODE. If set, user has been authenticated with NICKSERV IRC service.
.PP
.PP
.IP "\(bu" 2
\fIx\fP - NON-STANDARD MODE. If set, user's real IP is hidden by IRC servers, to prevent scriptkiddies to do nasty things to the user's computer.
.PP
.PP
Note that the actual list of user modes depends on the IRC server, and can be bigger. If you know the popular user modes, which aren't mentioned here - please contact me at tim@krasnogorsk.ru
.PP
Possible error responces for this command from the RFC1459:
.IP "\(bu" 2
\fBLIBIRC_RFC_ERR_NEEDMOREPARAMS\fP
.IP "\(bu" 2
\fBLIBIRC_RFC_ERR_NOSUCHNICK\fP
.IP "\(bu" 2
\fBLIBIRC_RFC_ERR_UNKNOWNMODE\fP
.IP "\(bu" 2
\fBLIBIRC_RFC_ERR_USERSDONTMATCH\fP
.IP "\(bu" 2
\fBLIBIRC_RFC_ERR_UMODEUNKNOWNFLAG\fP
.PP
.PP
And the mode information is given using reply code \fBLIBIRC_RFC_RPL_UMODEIS\fP 
.SS "int irc_cmd_whois (\fBirc_session_t\fP * session, const char * nick)"
.PP
Queries the information about the nick. 
.PP
\fBParameters:\fP
.RS 4
\fIsession\fP An initiated and connected session. 
.br
\fInick\fP A nick to query the information abour. Must not be NULL. A comma-separated list of several nicknames may be given.
.RE
.PP
\fBReturns:\fP
.RS 4
Return code 0 means success. Other value means error, the error code may be obtained through \fBirc_errno()\fP. Any error, generated by the IRC server, is available through \fBirc_callbacks_t::event_numeric\fP.
.RE
.PP
This function queries various information about the nick: username, real name, the IRC server used, the channels user is in, idle time, away mode and so on.
.PP
Possible error responces for this command from the RFC1459:
.IP "\(bu" 2
\fBLIBIRC_RFC_ERR_NOSUCHSERVER\fP
.IP "\(bu" 2
\fBLIBIRC_RFC_ERR_NOSUCHNICK\fP
.IP "\(bu" 2
\fBLIBIRC_RFC_ERR_NONICKNAMEGIVEN\fP
.PP
.PP
And the information is returned using the following reply codes. The whois query is completed when \fBLIBIRC_RFC_RPL_ENDOFWHOIS\fP message is received.
.IP "\(bu" 2
\fBLIBIRC_RFC_RPL_WHOISUSER\fP
.IP "\(bu" 2
\fBLIBIRC_RFC_RPL_WHOISCHANNELS\fP
.IP "\(bu" 2
\fBLIBIRC_RFC_RPL_WHOISSERVER\fP
.IP "\(bu" 2
\fBLIBIRC_RFC_RPL_AWAY\fP
.IP "\(bu" 2
\fBLIBIRC_RFC_RPL_WHOISOPERATOR\fP
.IP "\(bu" 2
\fBLIBIRC_RFC_RPL_WHOISIDLE\fP
.IP "\(bu" 2
\fBLIBIRC_RFC_RPL_ENDOFWHOIS\fP 
.PP

.SS "int irc_send_raw (\fBirc_session_t\fP * session, const char * format,  ...)"
.PP
Sends raw data to the IRC server. 
.PP
\fBParameters:\fP
.RS 4
\fIsession\fP An initiated and connected session. 
.br
\fIformat\fP A printf-formatted string, followed by function args.
.RE
.PP
\fBReturns:\fP
.RS 4
Return code 0 means success. Other value means error, the error code may be obtained through \fBirc_errno()\fP. Any error, generated by the IRC server, is available through \fBirc_callbacks_t::event_numeric\fP.
.RE
.PP
This function sends the raw data as-is to the IRC server. Use it to generate a server command, which is not (yet) provided by libircclient directly. 
